package com.zhouyu;

import org.springframework.boot.context.TypeExcludeFilter;
import org.springframework.core.type.classreading.MetadataReader;
import org.springframework.core.type.classreading.MetadataReaderFactory;
import org.springframework.stereotype.Component;

import java.io.IOException;


/**
 * TODO 这里加@Component 不会生效 因为在ComponentScan 扫描还未生成对应的bean实例
 *
 * 解决ApplicationContextInitializer 接口 初始化Application调用
 * {@link MyApplicationContextInitializer}
 */
//@Component
public class MyTypeExcludeFilter extends TypeExcludeFilter {

	@Override
	public boolean match(MetadataReader metadataReader, MetadataReaderFactory metadataReaderFactory) throws IOException {
		return metadataReader.getAnnotationMetadata().getClassName().equals("com.zhouyu.service.UserService");
	}
}
